<template>
  <div :class="{ 'rank-change': true, up: rankChange > 0, down: rankChange < 0 }" v-if="rankChange">
    <img v-if="rankChange > 0" :src="up" alt="" />
    <img v-if="rankChange < 0" :src="down" alt="" />
    {{ getAbs(rankChange) }}
  </div>
</template>

<script setup lang="ts">
import { getAbs } from '_t';
import config from '@/config/index.ts';
const { up, down } = config.imgs;
interface Props {
  rankChange: number;
}
withDefaults(defineProps<Props>(), {
  rankChange: 0
});
</script>

<style scoped lang="less">
.rank-change {
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  font-family: PingFangSC-Medium;
  font-weight: 500;
  img {
    height: 8px;
    margin-right: 2px;
  }
  &.up {
    color: #ff2929;
  }
  &.down {
    color: #10b246;
  }
}
</style>
